<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ include file="/page/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%-- <%@ include file="/adapter/adapter-easyui.jsp" %> --%>
<%@ include file="/adapter/adapter-bootstrap.jsp"%>
<link
	href="${pageContext.request.contextPath}/frontframe/easyui/themes/easyui-extend.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function save() {
		var str_data = $("#salesiteinfo input").map(function() {
			return ($(this).attr("name") + '=' + $(this).val());
		}).get().join("&");
		$.ajax({
			url : "${ctx}/appSaleSite/updateSaleSite",
			type : "POST",
			dataType : "json",
			data : str_data,
			async : false,
			success : function(data) {
				if (data.flag > 0) {
					alert("保存成功！");
					//window.location.reload();
				}
				/* 	          $.each(data, function(index, element) {
				 window.location.reload();
				 }); */
			},
			error : function() {
				alert("error");
			}
		});
	}

	function goBack() {
		//window.location.href='${ctx}/auth/appDeviceList?appid=${appid}';
		window.history.back(-1);
		//window.history.go(-2);
	}

	function changeValue(Value) {
		document.getElementById("saleSiteType").value = Value;
	}
	function showSelect() {
		document.getElementById("saleSiteType").value = '${appSaleSite.saleSiteType}';
		var saleSiteType = '${appSaleSite.saleSiteType}';
		var optionval = document.getElementById("saleSiteType1").options;
		//循环获得对应的节点
		for (var i = 0; i < optionval.length; i++) {
			//获得节点的值和后台传来的值进行比较
			if (optionval[i].value == saleSiteType) {
				//如果当前节点与后台传来的值一致，则将当前节点设置为选中状态，并跳出循环
				optionval[i].selected = true;
				break;
			}
		}
	}
</script>
</head>
<body onload="showSelect()">
	<div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title">设备基本信息</h3>
		</div>
		<div class="panel-body">
			<!-- <div id="p" class="easyui-panel" title="交易信息" style="width:100%;height:100%;padding:10px;" > -->
			<form class="form-horizontal" role="form" id="salesiteinfo">

				<div class="form-group">
					<label class="col-xs-2 control-label" for="saleSiteId">营业网点编号</label>
					<div class="col-xs-4">
						<input class="form-control" id="saleSiteId" name="saleSiteId"
							type="text" readonly="readonly" value="${appSaleSite.saleSiteId}" />
					</div>
					<label class="col-xs-2 control-label" for="saleSiteName">营业网点名称</label>
					<div class="col-xs-4">
						<input class="form-control" id="saleSiteName" name="saleSiteName"
							type="text" value="${appSaleSite.saleSiteName}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-2 control-label" for="appId">移动应用编号</label>
					<div class="col-xs-4">
						<input class="form-control" id="appId" name="appId" type="text"
							readonly="readonly" value="${appSaleSite.appId}" placeholder="" />
					</div>
					<label class="col-xs-2 control-label" for="saleSiteAddress">营业网点地址</label>
					<div class="col-xs-4">
						<input class="form-control" id="saleSiteAddress"
							name="saleSiteAddress" type="text"
							value="${appSaleSite.saleSiteAddress}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-2 control-label" for="saleSiteLongitude">商户网点精度坐标</label>
					<div class="col-xs-4">
						<input class="form-control" id="saleSiteLongitude"
							name="saleSiteLongitude" type="text"
							value="${appSaleSite.saleSiteLongitude}" />
					</div>
					<label class="col-xs-2 control-label" for="saleSiteLatitude">商户网点纬度坐标</label>
					<div class="col-xs-4">
						<input class="form-control" id="saleSiteLatitude"
							name="saleSiteLatitude" type="text"
							value="${appSaleSite.saleSiteLatitude}" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-2 control-label" for="saleSiteTel">联系电话</label>
					<div class="col-xs-4">
						<input class="form-control" id="saleSiteTel" name="saleSiteTel"
							type="text" value="${appSaleSite.saleSiteTel}" />
					</div>
					<label class="col-xs-2 control-label" for="saleSiteType">类型</label>
					<div class="col-xs-4">
						<input class="form-control" id="saleSiteType" name="saleSiteType"
							type="hidden" value="" placeholder="" /> <select
							class="form-control" id="saleSiteType1" name="saleSiteType1"
							onclick="changeValue(this.value)">
							<option value="BS" selected="selected">商户</option>
							<option value="SS">网点</option>
						</select>
					</div>
				</div>

				<div class="form-group">
					<label class="col-xs-2 control-label" for="saleSiteDesc">商户网点描述</label>
					<div class="col-xs-10">
						<input class="form-control" id="saleSiteDesc" name="saleSiteDesc"
							type="text" value="${appSaleSite.saleSiteDesc}" />
					</div>
				</div>

				<div class="form-group  text-center">
					<button type="button" class="btn btn-default" onclick="save();">保存</button>
					<button type="button" class="btn btn-default" onclick="goBack()">返回</button>
				</div>
			</form>
		</div>
	</div>

</body>
</html>
